package com.chinacoal.microservice;


import com.chinacoal.microservice.fallback.WechatOfficialAccountClientFallback;
import com.chinacoal.microservice.pojo.*;
import com.chinacoal.microservice.util.PassToken;
import com.chinacoal.microservice.util.QueryCriteria;
import com.chinacoal.microservice.util.Result;
import com.chinacoal.microservice.util.UserLoginToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 微信公众号
 * @date 2020-12-23 10：13
 */
@Api(tags = {"微信公众号"})
@FeignClient(name = "${spring.application.name}",fallback = WechatOfficialAccountClientFallback.class,configuration = FeignAutoConfiguration.class)
public interface WechatOfficialAccountClient {

    /**
     * @Description: 微信端-我的房间
     * @author zhuliang
     * @date 2020/12/23 9:39
     */
    @ApiOperation(value = "微信端-我的房间")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/wechatOfficialAccount/getRoomByWechat")
    public Result<List<CcmsSmartleasingContract>> getRoomByWechat(@RequestHeader("token") String token);

    /**
     * @Description: 微信端-工单信息列表
     * @author zhuliang
     * @date 2020/12/23 9:53
     */
    @ApiOperation(value = "微信端-工单信息列表")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/wechatOfficialAccount/getWorkOrderListByWechat")
    public Result<List<CcmsSmartleasingWorkOrder>> getWorkOrderListByWechat(@RequestHeader(value = "token") String token);

    /**
     * @Description: 微信端-新增工单信息的回显
     * @author zhuliang
     * @date 2020/12/23 10:28
     */
    @ApiOperation(value = "微信端-新增工单信息的回显")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/wechatOfficialAccount/workOrderEcho")
    public Result<CcmsSmartleasingTenant> workOrderEcho(@RequestHeader(value = "token") String token);

    /**
     * @Description: 微信端-新增工单信息
     * @author zhuliang
     * @date 2020/12/23 10:41
     */
    @ApiOperation(value = "微信端-新增工单信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "body", name = "workOrder", value = "工单实体类", required = true, dataType = "CcmsSmartleasingWorkOrder")
    })
    @PostMapping("smartleasing/wechatOfficialAccount/addWorkOrder")
    public Result addWorkOrder(@RequestHeader(value = "token") String token,
                               @RequestBody CcmsSmartleasingWorkOrder workOrder);

    /**
     * @Description: 微信端-修改个人信息
     * @author zhuliang
     * @date 2020/12/23 10:51
     */
    @ApiOperation(value = "微信端-修改个人信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "body", name = "tenant", value = "租户实体类", required = true, dataType = "CcmsSmartleasingTenant")
    })
    @PutMapping("smartleasing/wechatOfficialAccount/updateTenantByWechat")
    public Result updateTenantByWechat(@RequestHeader(value = "token") String token,
                                       @RequestBody CcmsSmartleasingTenant tenant);

    /**
     * @Description: 微信端-所有已缴费费用信息(带分页)
     * @author zhuliang
     * @date 2020/12/23 11:18
     */
    @ApiOperation(value = "微信端-所有已缴费费用信息(带分页)")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件实体类", required = true, dataType = "QueryCriteria")
    })
    @PostMapping("smartleasing/wechatOfficialAccount/getAllExpenseManagByWechat")
    public Result<List<CcmsSmartleasingExpenseManag>> getAllExpenseManagByWechat(@RequestHeader(value = "token") String token,
                                                                                 @RequestBody QueryCriteria queryCriteria);

    /**
     * @Description: 微信端-所有未缴费费用信息
     * @author zhuliang
     * @date 2020/12/23 14:50
     */
    @ApiOperation(value = "微信端-所有未缴费费用信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/wechatOfficialAccount/getUnpaidFeesInformationByWechat")
    public Result<List<CcmsSmartleasingExpenseManag>> getUnpaidFeesInformationByWechat(@RequestHeader(value = "token") String token);
    
    /**
     * @Description: 微信端-根据费用id查询通知单信息
     * @author zhuliang
     * @date 2020/12/23 15:26
     */
    @ApiOperation(value = "微信端-根据费用id查询通知单信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "fkExpenseManagId", value = "费用id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "type", value = "0缴费页面，1查询页面", required = true, dataType = "Integer")
    })
    @GetMapping("smartleasing/wechatOfficialAccount/getNoticeById/{fkExpenseManagId}/{type}")
    public Result<CcmsSmartleasingNotice> getNoticeById(@PathVariable(value = "fkExpenseManagId") String fkExpenseManagId,
                                                        @RequestHeader(value = "token") String token,
                                                        @PathVariable(value = "type") Integer type);

    /**
     * @Description: 微信端-生成预支付订单
     * @author zhuliang
     * @date 2020/12/25 10:34
     */

    @ApiOperation(value = "微信端-生成预支付订单")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "pkNoticeId", value = "通知单主键id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "sandBoxXml", value = "获取沙箱测试key的返回值", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/wechatOfficialAccount/wechatPreOrder")
    public Result wechatPreOrder(@RequestHeader(value = "token") String token,
                                 @RequestParam(value = "pkNoticeId") String pkNoticeId,
                                 @RequestParam(value = "sandBoxXml", required = false) String sandBoxXml);

    /**
     * @Description: 微信端-支付结果回调地址
     * @author zhuliang
     * @date 2020/12/25 11:51
     */
    @ApiOperation(value = "微信端-支付结果回调地址")
    @RequestMapping("smartleasing/wechatOfficialAccount/getPayNotify")
    public Result getPayNotify(HttpServletResponse response,
                               HttpServletRequest request);

    /**
     * @Description: 微信端-查询支付结果
     * @author zhuliang
     * @date 2020/12/25 18:01
     */
    @ApiOperation(value = "微信端-查询支付结果")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "pkNoticeId", value = "通知单主键id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "checkingOrderXml", value = "查询订单结果返回值", required = false, dataType = "String")
    })
    @PostMapping("smartleasing/wechatOfficialAccount/checkPaymentResult")
    public Result checkPaymentResult(@RequestHeader(value = "token") String token,
                                     @RequestParam(value = "pkNoticeId") String pkNoticeId,
                                     @RequestParam(value = "checkingOrderXml", required = false) String checkingOrderXml);

    /**
     * @Description: 微信端-好房快租-查询所有的房间
     * @author zhuliang
     * @date 2020/12/25 19:29
     */
    @ApiOperation(value = "微信端-好房快租-查询所有的房间")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件实体", required = true, dataType = "QueryCriteria")
    })
    @PostMapping("smartleasing/wechatOfficialAccount/getAllRoom")
    public Result<List<CcmsSmartleasingRoom>> getAllRoom(@RequestBody QueryCriteria queryCriteria);

    /**
     * @Description: 微信端-好房快租-条件查询所有的房间
     * @author zhuliang
     * @date 2020/12/25 19:30
     */
    @ApiOperation(value = "微信端-好房快租-条件查询所有的房间")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件实体", required = true, dataType = "QueryCriteria")
    })
    @PostMapping("smartleasing/wechatOfficialAccount/getRoomByCondition")
    public Result<List<CcmsSmartleasingRoom>> getWechatRoomByCondition(@RequestBody QueryCriteria queryCriteria);

    /**
     * @Description: 微信端-好房快租-根据房间id查询房间信息
     * @author zhuliang
     * @date 2020/12/25 19:32
     */
    @ApiOperation(value = "微信端-好房快租-根据房间id查询房间信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "pkRoomId", value = "房间主键id", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/wechatOfficialAccount/getWechatRoomById/{pkRoomId}")
    public Result getWechatRoomById(@PathVariable(value = "pkRoomId") String pkRoomId);

    /**
     * @Description: 微信端-修改密码
     * @author zhuliang
     * @date 2021/1/8 10:38
     */
    @ApiOperation(value = "微信端-修改密码")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "tenant", value = "租户信息实体", required = true, dataType = "CcmsSmartleasingTenant")
    })
    @PutMapping("smartleasing/wechatOfficialAccount/changePassword")
    public Result changePassword(@RequestBody CcmsSmartleasingTenant tenant);

    /**
     * @Description: 微信端-添加发票图片和发票pdf文件
     * @author zhuliang
     * @date 2021/2/2 10:13
     */
    @ApiOperation(value = "微信端-添加发票图片和发票pdf文件")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "imgUrl", value = "发票图片地址", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "pdfUrl", value = "发票pdf文件地址", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "pkInvoiceRecordId", value = "发票信息主键id", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/wechatOfficialAccount/addInvoicePicture")
    public Result addInvoicePicture(@RequestParam("imgUrl") String imgUrl,
                                    @RequestParam("pdfUrl") String pdfUrl,
                                    @RequestParam("pkInvoiceRecordId") String pkInvoiceRecordId);

    /**
     * @Description: 微信端-接收微信支付下单返回值
     * @author zhuliang
     * @date 2021/2/3 9:12
     */
    @ApiOperation(value = "微信端-接收微信支付下单返回值")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "xmlStr", value = "微信支付下单返回值", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "orderNo", value = "微信支付订单号", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "pkNoticeId", value = "费用通知单主键id", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/wechatOfficialAccount/getWeChatJspiPayData")
    public Result getWeChatJspiPayData(@RequestParam("xmlStr") String xmlStr,
                                       @RequestParam("orderNo") String orderNo,
                                       @RequestParam("pkNoticeId") String pkNoticeId);
}
